{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {
    "nbsphinx": "hidden"
   },
   "source": [
    "# Characterization of Systems in the Time Domain\n",
    "\n",
    "*This Jupyter notebook is part of a [collection of notebooks](../index.ipynb) in the bachelors module Signals and Systems, Communications Engineering, Universität Rostock. Please direct questions and suggestions to [Sascha.Spors@uni-rostock.de](mailto:Sascha.Spors@uni-rostock.de).*"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Eigenfunctions\n",
    "\n",
    "An [eigenfunction](https://en.wikipedia.org/wiki/Eigenfunction) of a system is defined as the input signal $x(t)$ which produces the output signal $y(t) = \\mathcal{H}\\{ x(t) \\} = \\lambda \\cdot x(t)$ with $\\lambda \\in \\mathbb{C}$. The weight $\\lambda$ associated with $x(t)$ is known as scalar eigenvalue of the system. Hence, besides a weighting factor, an eigenfunction is not modified by passing through the system.\n",
    "\n",
    "[Complex exponential signals](../continuous_signals/standard_signals.ipynb#Complex-Exponential-Signal) $e^{s t}$ with $s \\in \\mathbb{C}$ are eigenfunctions of linear time-invariant (LTI) systems. This can be proven by applying the properties of LTI systems. Lets assume a generic LTI system with input signal $x(t) = e^{s t}$ and output signal $y(t) = \\mathcal{H}\\{ x(t) \\}$. The response of the LTI system to the shifted input signal $x(t-\\tau) = e^{s (t-\\tau)}$ reads\n",
    "\n",
    "\\begin{equation}\n",
    "y(t - \\tau) = \\mathcal{H}\\{ x(t-\\tau) \\} = \\mathcal{H}\\{ e^{-s \\tau} \\cdot e^{s t}  \\}\n",
    "\\end{equation}\n",
    "\n",
    "due to the implied shift-invariance. Now considering the implied linearity this can be reformulated as\n",
    "\n",
    "\\begin{equation}\n",
    "y(t - \\tau) =  e^{-s \\tau} \\cdot \\mathcal{H}\\{ e^{s t}  \\} = e^{-s \\tau} \\cdot y(t)\n",
    "\\end{equation}\n",
    "\n",
    "It is straightforward to show that $y(t) = \\lambda e^{st}$ fulfills above equation\n",
    "\n",
    "\\begin{equation}\n",
    "\\lambda e^{s t} e^{-s \\tau} = e^{-s \\tau} \\lambda e^{st}\n",
    "\\end{equation}"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**Example**\n",
    "\n",
    "An LTI system whose input/output relation is given by the following inhomogeneous linear ordinary differential equation (ODE) with constant coefficients is investigated\n",
    "\n",
    "\\begin{equation}\n",
    "a_0 y(t) + a_1 \\frac{d y(t)}{dt} + a_2 \\frac{d^2 y(t)}{dt^2} = x(t)\n",
    "\\end{equation}\n",
    "\n",
    "with $a_i \\in \\mathbb{R} \\quad \\forall i$. In the remainder, the output signal $y(t)$ of the system is computed by explicit solution of the ODE for $x(t) = e^{s t}$ as input signal. Integration constants are discarded for ease of illustration."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAM4AAAAxCAYAAACS25YIAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAJGElEQVR4Ae2djXXUOBDHE14KCKQCQgchVAB0EO4qADpIXirI4zoAKgihA0IF5OiAdHCBDnL/n1bSk73+0Dr2eteeeU/R10ieGWk8ow9vdu/v73cMTAJdJLC7u/uv2r3RHLrt0n6b2+ya4mzz8I1Hu5RmX0//rfmzOx4V4z350XiPtidvuQReif6fW85DZ/LN4nQW3fQbyqp8EJf/KfxRuJN1+aqyQ6XfK5z48mvFl6qblRKZ4mjUDZYlIAX5qNIrKcS10kdKnyv9JmCqjPXNBcoUyuYUm+LMabRX4FWK8U3oTxRQoC9SEKxOBNWzq/S4XB4RJp4wxZn4AHdlz1uZ72rPJgBK81xK4nbPVMf6Bmv0WPEswTYHZjnszUxLMVjH3HrFeEZagTVNAFw31jY7wt33+KFuFrEpziyGucikn+wfFJ/68JGyBAs37Zi8tzIoiVMUygQo0w+XWqx97BzHC8OiiUpACoKbxbqFg0u3E6YyLMjfyp/BtvLvFN0psMYB3I7aIunq6YONAjYIbkI/oX4Osa1x5jDKnkcpBC7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YCBUExHEjInDmRv1mU7LwQXrpp4ItjhNKs7Y3cE82R+CTBOoi1WATJAleyPDFj/RCJh/AnerH80FzeAOmNt70hmN7SPl+K7s8SOrcnOLO4VOBN6/7JrM8rii4aioLCBUBpmhQr4PUZ59K8yjPfCpnNDuQQgPOLqo2LUD9UvDJ/opuXHWuYpUNLlfXGmymOH3L/hqu6ClQoE96tBgeFqbIuzq3zXQ4e5dK8CiHqEx7WykcdfavyF5RG7ZxrqTyWJx5a9smbuWp1o9Zczk0JzL4DDRBpto27WhwUkTBFWAtvXmlwMS9QGK80WMm7IYRa+z3OEA+bUp8aGNwBgCspnBWwC7Wxk99PLCYSSs6bGOVnW3pjrxKJvmwQf2xd75cbiL9Bfojlf6GaVvOpmwYyAAAAAElFTkSuQmCC\n",
      "text/latex": [
       "$\\displaystyle y{\\left(t \\right)} = \\frac{e^{s t}}{a_{0} + a_{1} s + a_{2} s^{2}}$"
      ],
      "text/plain": [
       "               s⋅t      \n",
       "              ℯ         \n",
       "y(t) = ─────────────────\n",
       "                       2\n",
       "       a₀ + a₁⋅s + a₂⋅s "
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import sympy as sym\n",
    "%matplotlib inline\n",
    "sym.init_printing()\n",
    "\n",
    "t, s, a0, a1, a2 = sym.symbols('t s a:3')\n",
    "x = sym.exp(s * t)\n",
    "y = sym.Function('y')(t)\n",
    "\n",
    "ode = sym.Eq(a0*y + a1*y.diff(t) + a2*y.diff(t, 2), x)\n",
    "solution = sym.dsolve(ode)\n",
    "solution.subs({'C1': 0, 'C2': 0})"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**Exercises**\n",
    "\n",
    "* Is the complex exponential signal an eigenfunction of the system?\n",
    "* Introduce $x(t) = e^{s t}$ and $y(t) = \\lambda \\cdot e^{s t}$ into the ODE and solve manually for the eigenvalue $\\lambda$. How is the result related to above result derived by solving the ODE?\n",
    "* Can you generalize your findings to an ODE of arbitrary order?"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**Example**\n",
    "\n",
    "The following inhomogeneous linear ODE with time-dependent coefficient is considered as an example for a **time-variant** but linear system\n",
    "\n",
    "\\begin{equation}\n",
    "t \\cdot \\frac{d y(t)}{dt} = x(t)\n",
    "\\end{equation}\n",
    "\n",
    "The output signal $y(t)$ of the system for a complex exponential signal at the input $x(t) = e^{st}$ is computed by explicit solution of the ODE. Again integration constants are discarded."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAHUAAAAVCAYAAAB48KHmAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAE30lEQVRoBeWZgVVVORCGfe9QgEc7wA7YtQPpQLcE7ABL8LAd4FawBzuQDlzoADtQ6ID9vphcc0Nyb+57gChzzrybO5mZTP5MJrmwur6+frItrVarXfx8mfPTqzfn51fuv20Mav7W2wKE00N87HX62Y36neq/l9pCrHonfwPTrRaVIF8z8nN26ceeCNA7VS/a9ZjcmQ4x7MGf4Av4MrLvJxmfZX0HKRhkAqnNIEt9rSe6i7Bq+SnlVUwRPtmEcf4UPmvZxv4Lnpbm0Rja2V/Kf8Y7cbyCPYNOauMbJ/wJPkr9tJPNcZJNPaOPJlZTtnlf9DOL6Qjs3MFcmwGO4YOWHn1mJt3jBfVdO7gLkJr9bcqIYxduLmqM14UdLTrv3UmJ7iRWvfPBTxem2yzq5VQwcSLN7KT/Eu4GZmqsbfqIYXZR9Q9tnITYTmLVG78xwLOYbnSmcj5YfuZuu+qEM5RnjbT/q9bxEGTOMc4zhWMJXkydWPX67cI0LCoDP4UP4WOf+Qix7ySX0X4D31gwdAXCi4YAuAO8jPg+8olc0n4/tB7mz+hGz24Kl0Hm4iUpXaBKXGozqWJVKuLzSJwi27bke6lcjmksLeESgA9r9qhU8O75h9qPs5F3LzobnafJT/TbLCVJzydk2fGCsIRHZ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}{\\left(s t \\right)}$"
      ],
      "text/plain": [
       "y(t) = Ei(s⋅t)"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ode = sym.Eq(t*y.diff(t), x)\n",
    "solution = sym.dsolve(ode)\n",
    "solution.subs('C1', 0)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Note, $\\text{Ei}(\\cdot)$ denotes the [exponential integral](http://docs.sympy.org/latest/modules/functions/special.html#sympy.functions.special.error_functions.Ei). The response $y(t)$ of the time-variant system is not equal to a weighted complex exponential signal $\\lambda \\cdot e^{s t}$. It can be concluded that complex exponentials are no eigenfunctions of this particular time-variant system."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**Example**\n",
    "\n",
    "A final example considers the following non-linear inhomogeneous ODE with constant coefficients\n",
    "\n",
    "\\begin{equation}\n",
    "\\left( \\frac{d y(t)}{dt} \\right)^2 = x(t)\n",
    "\\end{equation}\n",
    "\n",
    "as example for a **non-linear** but time-invariant system. Again, the output signal $y(t)$ of the system for a complex exponential signal at the input $x(t) = e^{st}$ is computed by explicit solution of the ODE. As before, integration constants are discarded."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAgoAAAA/CAYAAACB6eBiAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAVvUlEQVR4Ae2dS7LURhaGgWDUgw6DV9B2RC/A4FEPDTvgsQLMDkzcFRCwA+wVGNgBZgWAdwA97oHx3cHt/9PNzCup9C5Jlar6M0IlKZ8n/8yT5+jko65fu3btnq53uuruy8XFxfd1T79XEbh+/fp38nmlC7yeVkP9ZgSMgBFoR8DjRzs2DlkXAfXFTyrxh4ZSH94sed4vPfP4tfbu1xoCAvZneaEk/KHrWS0461fR/kYEPliCSClM15fI13kagWNC4JDjh/n/mHrSbHV5opxu13IrjAhJUdDgj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AocBKGEXhmOAJbcY7wpetkl/kh5KBgKf/k8dHXeSHUhHPPCA+Ow/SboRQLulYgxDLjnmSF3mU8ySssZ8oLywH0QKgx8KcuOMX/CO9UemBXujinS8stk2iHOC+1QVPJyy66C5S+GcVBNQOg8eP0Gbm/1rLBFzM+yvwvrBme+QTKwq1Ttj3OobR+/JyuBEwAqeFgMeP02rvrdc2Kgo3tl4R028EjIARMAJGwAgsh4AVhfHYxm1vY+a2x5fiFEbACBwjAh4/jrFVj7xOVhTGN3A8uGZn5e34rJzCCBiBE0PA48eJNfgxVNdrFCa0ouZtOKudxYVeADoBPycxAqeMgMePU279bdXdaxT2a6/i3xsFIivU7YyAETACYxDw+DEGLcc9OAK2KExsAikJmBDZsnZHlgUOtbEzAkbACAxCwOPHIJgc6cAI2KKwfwNw8AcKAn/6xL55OyNgBIzAUAQ8fgxFyvEOjkBazChhd1G7OMDFrgUBWRE4KIc/5MCMyL/2pWN0W5LY2wgYASNQIODxwx0hNwQkw/joregBorE4xI2pBx7iaW9l2vmjGZvUy4i0PAtcpiBuC690El5LVHsbASNgBCoIePyowOGXAyEQ+2FD8R//D6NWXclS6qAzAAAAAElFTkSuQmCC\n",
      "text/latex": [
       "$\\displaystyle \\left[ y{\\left(t \\right)} = \\begin{cases} - \\frac{2 \\sqrt{e^{s t}}}{s} & \\text{for}\\: s \\neq 0 \\\\- t & \\text{otherwise} \\end{cases}, \\  y{\\left(t \\right)} = \\begin{cases} \\frac{2 \\sqrt{e^{s t}}}{s} & \\text{for}\\: s \\neq 0 \\\\t & \\text{otherwise} \\end{cases}\\right]$"
      ],
      "text/plain": [
       "⎡       ⎧      ______                     ⎧     ______           ⎤\n",
       "⎢       ⎪     ╱  s⋅t                      ⎪    ╱  s⋅t            ⎥\n",
       "⎢       ⎪-2⋅╲╱  ℯ                         ⎪2⋅╲╱  ℯ               ⎥\n",
       "⎢y(t) = ⎨─────────────  for s ≠ 0, y(t) = ⎨───────────  for s ≠ 0⎥\n",
       "⎢       ⎪      s                          ⎪     s                ⎥\n",
       "⎢       ⎪                                 ⎪                      ⎥\n",
       "⎣       ⎩     -t        otherwise         ⎩     t       otherwise⎦"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ode = sym.Eq(y.diff(t)**2, x)\n",
    "solution = sym.dsolve(ode)\n",
    "[si.subs('C1', 0) for si in solution]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Obviously for this non-linear system complex exponential signals are no eigenfunctions."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Transfer Function\n",
    "\n",
    "The complex eigenvalue $\\lambda$ constitutes the weight of a complex exponential signal $e^{st}$ (using complex frequency $s$) experiences when passing through an LTI system. It is commonly termed as [*transfer function*](https://en.wikipedia.org/wiki/Transfer_function) and is denoted by $H(s)=\\lambda(s)$. Using this definition, the output signal $y(t)$ of an LTI system for a complex exponential signal at the input reads\n",
    "\n",
    "\\begin{equation}\n",
    "y(t) = \\mathcal{H} \\{ e^{st} \\} = H(s) \\cdot e^{st}\n",
    "\\end{equation}\n",
    "\n",
    "Note that the concept of the transfer function is directly linked to the linearity and time-invariance of a system. Only in this case, complex exponential signals are eigenfunctions of the system and $H(s)$ describes the properties of an LTI system with respect to these.\n",
    "\n",
    "Above equation can be rewritten in terms of the magnitude $| H(s) |$ and phase $\\varphi(s) = \\arg \\{ H(s) \\}$ of the complex transfer function $H(s)$\n",
    "\n",
    "\\begin{equation}\n",
    "y(t) = | H(s) | \\cdot e^{s t + j \\varphi(s)}\n",
    "\\end{equation}\n",
    "\n",
    "The magnitude $| H(s) |$ provides the frequency dependent attenuation/amplification of the eigenfunction $e^{st}$ by the system, while $\\varphi(s)$ provides the introduced phase-shift."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Link between Transfer Function and Impulse Response\n",
    "\n",
    "In order to establish a link between the transfer function $H(s)$ and the impulse response $h(t)$, the output signal $y(t) = \\mathcal{H} \\{ x(t) \\}$ of an LTI system with input signal $x(t)$ is considered. It is given by convolving the input signal with the impulse response\n",
    "\n",
    "\\begin{equation}\n",
    "y(t) = x(t) * h(t) = \\int_{-\\infty}^{\\infty} x(t-\\tau) \\cdot h(\\tau) \\; d\\tau\n",
    "\\end{equation}\n",
    "\n",
    "For a complex exponential signal as input $x(t) = e^{st}$, the output of an LTI system is given as $y(t) = \\mathcal{H} \\{ e^{st} \\} = H(s) \\cdot e^{st}$. Introducing both signals into the convolution integral yields\n",
    "\n",
    "\\begin{equation}\n",
    "H(s) \\cdot e^{st} = \\int_{-\\infty}^{\\infty} e^{st} e^{-s \\tau} \\cdot h(\\tau) \\; d\\tau\n",
    "\\end{equation}\n",
    "\n",
    "which after canceling $e^{s t}$ (the integral depends not on $t$) results in\n",
    "\n",
    "\\begin{equation}\n",
    "H(s) = \\int_{-\\infty}^{\\infty} h(\\tau) \\cdot e^{-s \\tau}  \\; d\\tau\n",
    "\\end{equation}\n",
    "\n",
    "under the assumption that the integral converges.\n",
    "The transfer function $H(s)$ can be computed from the impulse response $h(t)$ by integrating over the impulse response multiplied with the complex exponential function $e^{- s \\tau}$. This constitutes an integral transformation, which is later introduced in more detail as [Laplace transform](https://en.wikipedia.org/wiki/Laplace_transform).\n",
    "Usually the temporal variable $t$ is then used\n",
    "\n",
    "\\begin{equation}\n",
    "H(s) = \\int_{-\\infty}^{\\infty} h(t) \\cdot e^{-s t}  \\; d t\n",
    "\\end{equation}\n",
    "rather than $\\tau$ which remained from the convolution integral calculus.\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "nbsphinx": "hidden"
   },
   "source": [
    "**Copyright**\n",
    "\n",
    "This notebook is provided as [Open Educational Resource](https://en.wikipedia.org/wiki/Open_educational_resources). Feel free to use the notebook for your own purposes. The text is licensed under [Creative Commons Attribution 4.0](https://creativecommons.org/licenses/by/4.0/), the code of the IPython examples under the [MIT license](https://opensource.org/licenses/MIT). Please attribute the work as follows: *Sascha Spors, Continuous- and Discrete-Time Signals and Systems - Theory and Computational Examples*."
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 1
}
